Digital refraction